import os
from openai import OpenAI
os.environ["DASHSCOPE_API_KEY"] = 'sk-965dc39b016c49ecbe29de180f4db2b6'
from langchain_community.chat_models.tongyi import ChatTongyi
from langchain_core.messages import HumanMessage

client = OpenAI(
    api_key='hk-mtiquv1000041663a49a34520ad3294132cbce7abf1c2ef3',
    base_url="https://api.openai-hk.com/v1",
)
# completion = client.chat.completions.create(
#     model="gpt-3.5-turbo",
#     messages=[{"role": "user", "content": "用七言绝句的形式写一首关于学习的诗"}]
# )
def collect(instruction,query):
    prompt = f"{instruction}\n{query}"
    response =client.chat.completions.create(model='gpt-3.5-turbo',
                                             messages=[{"role": "user", "content": prompt}]
        #                                      messages=[
        # {"role":"user","content":prompt}
    )
    return response.choices[0].message

print(collect(instruction='请完善下面任务列表:',query='任务1:把我爱中国翻译成英文\n任务2:读写一篇爱国的作文，100字以内。'))

